Callbacks in choice dialog boxes

Hello there,

I'm trying to pass an event through a choice dialog box in DOORS.

At the moment I have a button that checks what is currently selected in the dialog box and act accordingly. I want to get rid of the button and have the event happen when a new value is selected from the drop down box.

Is there a way to do this?

How do dialog boxes (choice) handle events?

Many Thanks

Alex
aikemp - Wed Jun 01 10:41:38 EDT 2011

Re: Callbacks in choice dialog boxes
SystemAdmin - Wed Jun 01 12:59:57 EDT 2011

Use the "set" function to set a callback function on the choice DBE. For an example on this see the "Constrained placement full example program" section in DXL Help.

Re: Callbacks in choice dialog boxes
llandale - Wed Jun 01 13:48:58 EDT 2011

Here's a sample:

DB    db
DBE     dbe
 
string  Choices[] = {"A", "B", "C", "D"}
 
void    clbkChoice(DBE dbeXX)
{       // React to changes in the Choice DBE
    int         iSelected = get(dbe)   // perhaps use "dbeXX", the called parameter here
    string      sSelected = get(dbe)
    infoBox("Selected: " iSelected "   " sSelected)
}
 
db      = create("Choice Callback")
dbe     = choice(db, "Choice", Choices, 3, 1, 5, true)
set(dbe, clbkChoice)    // c
show(db)


Notice the "3" in the "choice" command, causing only the 1st three value to be available, dropping off the 4th "D".

When you make a new selection you get the "Selected" info box. Look at the results carefully, I find it VERY interesting that in the callback the "int get" function gets the newly selected value, but the "string get" function retrieves the FORMERLY selected value. You would therefore need to get the index and then retrieve the value from your global "Choices" vector.

 

 

  • Louie


Louie's mantra: "... I am a 3 year old, the world is as the world should be...".